<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=0">

		<title>我的收藏</title>

		<link href="../AmazeUI-2.4.2/assets/css/admin.css" rel="stylesheet" type="text/css">
		<link href="../AmazeUI-2.4.2/assets/css/amazeui.css" rel="stylesheet" type="text/css">

		<link href="../css/personal.css" rel="stylesheet" type="text/css">
		<link href="../css/colstyle.css" rel="stylesheet" type="text/css">
		<script type="text/javascript" src="../js/vue2.5.js" ></script>
		<script type="text/javascript" src="../js/axios.min.js" ></script>
		<script type="text/javascript" src="../js/jquery-1.11.2.min.js" ></script>
		<script type="text/javascript" src="../js/global.js" ></script>
		<script type="text/javascript" src="../js/bootstrap/js/bootstrap.js" ></script>
		<script type="text/javascript" src="../js/layer/layer.js" ></script>
		<script src="../js/param.js"></script>
	</head>

	<body>
		
            <div class="nav-table">
					   <div class="long-title"><span class="all-goods">全部分类</span></div>
					   <div class="nav-cont">
							<ul>
								<li class="index"><a href="../index.html">首页</a></li>
								<li class="qc"><a href="text.html">推荐</a></li>
								<li class="qc"><a href="../home/search.html">搜索</a></li>
								<li class="qc"><a href="#">团购</a></li>
								<li class="qc last"><a href="about.html">我们</a></li>
							</ul>
						</div>
			</div>
			<b class="line"></b>
		<div class="center container">
			<div class="col-main">
				<div class="main-wrap">

					<div class="user-collection">
						<!--标题 -->
						<div class="am-cf am-padding">
							<div class="am-fl am-cf"><strong class="am-text-danger am-text-lg">我的收藏</strong> / <small>My&nbsp;Collection</small></div>
						</div>
						<hr/>

						<div class="you-like">
							<div class="s-bar">
								我的收藏
								
							</div>
							<div class="s-content">
							
								<div class="s-item-wrap" v-for="(collection,index) in collectionData">
									<div class="s-item">

										<div class="s-pic">
											<a href="#" class="s-pic-link">
												<img :src="baseUrl+'/goods/getgoods?gid='+ collection.goods.gid"   class="s-pic-img s-guess-item-img">
											</a>
										</div>
										<div class="s-info">
											<div class="s-title"><a href="#" >{{collection.goods.gname}}{{collection.goods.gdesc}}</a></div>
											<div class="s-price-box">
												<span class="s-price"><em class="s-price-sign">¥</em><em class="s-value">{{collection.goods.gprice}}.00</em></span>
												<span class="s-history-price"><em class="s-price-sign">¥</em><em class="s-value">{{collection.goods.gprice*1.5}}0</em></span>
											</div>
											<div class="s-extra-box">
												
											</div>
										</div>
										<div class="s-tp">
											<span class="ui-btn-loading-before" @click="remove(collection.coid,index)">移除</span>
											<i class="am-icon-shopping-cart"></i>
											<span class="ui-btn-loading-before buy" @click="addcart()">加入购物车</span>
											<p>
												<a href="javascript:;" class="c-nodo J_delFav_btn">取消收藏</a>
											</p>
										</div>
									</div>
								</div>

								
								

							</div>

							<div class="s-more-btn i-load-more-item" data-screen="0"><i class="am-icon-refresh am-icon-fw"></i>更多</div>

						</div>

					</div>

				</div>
				<!--底部-->
				<div class="footer">
					<div class="footer-hd">
						<p>
							
							<b>|</b>
							<a href="#">商城首页</a>
							<b>|</b>
							<a href="#">支付宝</a>
							<b>|</b>
							<a href="#">物流</a>
						</p>
					</div>
					<div class="footer-bd">
						<p>
							
							<a href="#">合作伙伴</a>
							<a href="#">联系我们</a>
							<a href="#">网站地图</a>
							<em>© 2015-2025 Hengwang.com 版权所有. 更多模板 <a href="http://www.cssmoban.com/" target="_blank" title="模板之家"></a> - Collect from <a href="http://www.cssmoban.com/" title="网页模板" target="_blank">网页模板</a></em>
						</p>
					</div>
				</div>
			</div>

			<aside class="menu">
				<ul>
					<li class="person active">
						<a href="person/index.html"><i class="am-icon-user"></i>个人中心</a>
					</li>
					<!--管理员界面-->
					<li class="person">
						<p><i class="am-icon-qq"></i>管理系统</p>
						<ul>
							<li> <a href="querygoods.html">商品管理</a></li>
							<li> <a href="queryorder.html">订单管理</a></li>		
							
						</ul>
					</li>
					<!--普通界面-->
					<li class="person">
						<p><i class="am-icon-newspaper-o"></i>个人资料</p>
						<ul>
							<li> <a href="information.html">个人信息</a></li>
							<li> <a href="safety.html">安全设置</a></li>
							<li> <a href="address.html">地址管理</a></li>
							
						</ul>
					</li>
					<li class="person">
						<p><i class="am-icon-balance-scale"></i>我的交易</p>
						<ul>
							<li><a href="order.html">订单管理</a></li>
							<li> <a href="change.html">退款售后</a></li>
							<li> <a href="comment.html">评价商品</a></li>
						</ul>
					</li>
					
					<li class="person">
						<p><i class="am-icon-tags"></i>我的收藏</p>
						<ul>
							<li> <a href="collection.html">收藏</a></li>
																			
						</ul>
					</li>
					<li class="person">
						<p><i class="am-icon-qrcode"></i>在线客服</p>
						<ul>
							<li> <a href="suggest.html">意见反馈</a></li>		
							<li> <a href="news.html">我的消息</a></li>
						</ul>
					</li>
					
				</ul>

			</aside>
		</div>
		<script>
		var uid = localStorage.getItem('id');
		//vue
		
		var vue = new Vue({
			el: '.container',
			data: {
				collectionData: [], //商品数据
				baseUrl:baseUrl
			},
			methods: {
				//查询数据方法
				query: function() {
					axios.get(baseUrl + '/collection/query', {
							params: {
								uid:uid
							}
						})
						.then(function(response) {
							this.collectionData = response.data;

						}.bind(this))
						.catch(function(error) {
							layer.msg('获得数据失败');
						});
						
					
				},
				//删除
				remove:function(coid,index){
					var that = this;
					layer.confirm('确定要移除此商品吗', {
					    btn: ['是的','取消'] //按钮
					}, function(){
					    layer.msg('移除成功', {icon: 1});
					    axios.get(baseUrl + '/collection/delete',{
							params:{
								coid:coid
							}
						})
						.then(function(response) {
							that.collectionData.splice(index,1);
							layer.msg('移除成功！');
						}.bind(that))
						.catch(function(error) {
							layer.msg('移除失败');
						});
					}, function(){
					    layer.msg('取消移除');
					});
					//ajax
					
				},addcart:function(){
					location.href="../home/shopcart.html";
				}
				
				
			},
			mounted: function() {
				this.query();
				
			}
		})
		</script>
	</body>

</html>